from sqlalchemy import Sequence, Column
from sqlalchemy.orm import relationship
from sqlalchemy.types import Integer, String
from __init__ import Base

class Users(Base):

    __tablename__ = "users"

    id = Column(Integer, Sequence('user_id_seq'), primary_key=True)
    username = Column(String(10))
    name = Column(String(50))
    database = Column(String(100))
    password = Column(String(20))
    email = Column(String(50))

    dashboards = relationship('Dashboards')
    usergrid = relationship('UserGrid')
    usergroup = relationship('UserGroup')
    useroperation = relationship('UserOperation')
    operations = relationship('Operations')
    comments = relationship('Comments')

    def __init__(self, username, name, database, password, email):
        self.username = username
        self.name = name
        self.database = database
        self.password = password
        self.email = email

    def __repr__(self):
        return "<User('%s', '%s', '%s', '%s', '%s')>" % (self.name, self.username, self.password, self.database, self.email)
